package helper;

import android.os.Parcel;
import android.os.Parcelable;

public class Exercise implements Parcelable {
	private int id;
	private String name;
	private String groupName;

	public Exercise(int id, String name, String groupName) {
		this.id = id;
		this.name = name;
		this.groupName = groupName;
	}
	
	public Exercise(int id, String name) {
		this.id = id;
		this.name = name;
		this.groupName = "not specified";
	}

	public Exercise(Parcel in) {
		readFromParcel(in);
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(name);
		dest.writeInt(id);

	}

	private void readFromParcel(Parcel in) {

		// We just need to read back each
		// field in the order that it was
		// written to the parcel
		name = in.readString();
		id = in.readInt();
	}

	/**
	 * standard getter
	 * 
	 * @return strValue
	 */
	public String getStrValue() {
		return name;
	}

	/**
	 * Standard setter
	 * 
	 * @param strValue
	 */
	public void setStrValue(String strValue) {
		this.name = strValue;
	}

	/**
	 * standard getter
	 * 
	 * @return
	 */
	public Integer getIntValue() {
		return id;
	}

	public void setIntValue(Integer intValue) {
		this.id = intValue;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
		public Exercise createFromParcel(Parcel in) {
			return new Exercise(in);
		}

		public Exercise[] newArray(int size) {
			return new Exercise[size];
		}
	};
}
